ALTER PROCEDURE [dbo].[CPP_Family_Get]
  @dwUserID INT,
	@dwKindID INT
AS
BEGIN

	SELECT
		a.ID,
		c.Channel,
		b.KindID,
		a.MemberUID AS UserID,
		a.FamilyID,
		b.Code AS FamilyCode,
		b.Caption AS FamilyCaption,
		a.UpdateTime AS BindTime,
		c.UserID AS AUserID,
		c.GameID AS AGameID,
		c.NickName AS ANickName,
		ISNULL(d.HeadImgUrl, '') AS AAvatar,
		a.UserRight,
		ISNULL(e.UserData, '') AS RuleData,
		ISNULL(e.RecordID, 0) AS RuleID
	FROM
		RYWebSMSDB.dbo.FamilyMember AS a
	LEFT JOIN RYWebSMSDB.dbo.Family AS b ON a.FamilyID = b.ID
	LEFT JOIN RYAccountsDB.dbo.AccountsInfo c ON c.UserID = b.AUID
	LEFT JOIN RYAccountsDB.dbo.IndividualDatum d ON d.UserID = b.AUID
	LEFT JOIN RYRecordDB.dbo.RecordProxyGameRule e ON e.GroupID = b.Code /* AND e.UserID = a.MemberUID*/
	WHERE
		a.Status = 1 AND c.AccountsType = 1 AND a.MemberUID = @dwUserID AND b.KindID = @dwKindID

	IF @@ROWCOUNT <= 0 BEGIN
		RETURN 1;
	END ELSE BEGIN
		RETURN 0;
	END

END
